package cn.codeforfun.initialization.command;

/**
 * @author wangbin
 */
public final class CommandConstants {
    private static final String HOME_PATH = "$HOME";
    private static final String COMMAND_PATH = HOME_PATH + "/test";
    static final String COMMAND_SYSTEM_VERSION = "cat /etc/os-release";
    static final String COMMAND_KERNEL_VERSION = "uname -r";
    static final String COMMAND_DOCKER_INFO = "docker info";
    static final String COMMAND_HELM_VERSION = "helm version";
    static final String COMMAND_KUBECTL_VERSION = "kubectl version";

    static final String COMMAND_INSTALL_DOCKER = "curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun";
    static final String COMMAND_CENTOS_START_DOCKER = "systemctl start docker";

    public static final String COMMAND_TEST = "cat > " + COMMAND_PATH + "/test.sh <<EOF\ndocker ps\nEOF";
    public static final String COMMAND_TEST_ADD_AUTH = "chmod +x " + COMMAND_PATH + "/test.sh";

    static final String ERROR_MESSAGE_NO_SUCH_FILE_OR_DIRECTORY = "No such file or directory";
    static final String ERROR_MESSAGE_COMMAND_NOT_FOUND = "command not found";
    static final String ERROR_MESSAGE_DOCKER_NOT_RUNNING = "ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?";
    static final String HELM_VERSION = "curl -s https://gitee.com/consolelog/online-text/raw/master/helm_stable_version.txt";
    static final String HELM_FOLDER_NAME = "linux-amd64";
    static final String HELM_FILE_NAME = "helm-${HELM_VERSION}-linux-amd64.tar.gz";
    static final String HELM_URL = "https://www.rancher.cn/download/helm/${HELM_FILE_NAME}";

    static final String KUBECTL_VERSION = "curl -s https://gitee.com/consolelog/online-text/raw/master/kubectl_stable_version.txt";
    static final String KUBECTL_FILE_NAME = "linux-amd64-${KUBECTL_VERSION}-kubectl";
    static final String KUBECTL_URL = "https://www.rancher.cn/download/kubernetes/${KUBECTL_FILE_NAME}";

    static final String COMMAND_DOWNLOAD_FILE = "wget ${FILE_URL}";
    static final String COMMAND_MOVE_FILE = "mv ${SOURCE_PATH} ${TARGET_PATH}";
    static final String COMMAND_ADD_AUTHORITY = "chmod +x ${FILE_PATH}";

    static final String COMMAND_DELETE_FILE = "rm -rf ${FILE_NAME}";

    static final String UNZIP_TAR = "tar zxvf ${FILE_NAME} -C .";
}
